package com.canyou.model;

import com.jfinal.plugin.activerecord.Model;

/**
 * 用户表
 * 
 * @created cgz 2012-12-23
 */
public class User extends Model<User> {

	private static final long serialVersionUID = -2941405040213802557L;

	public static final User dao = new User();

	/**
	 * 根据用户名和密码获取用户是否存在
	 * 
	 * @author cgz 2012-12-23
	 * @param name
	 * @param pwd
	 * @return
	 */
	public User findByNamePwd(String name, String pwd) {
		return dao.findFirst(
				"select top 1 Id, UserName, RoleId from Admin_User_tb "
						+ "where UserName=? and Password=? and IsUsed = 1",
				name, pwd);
	}
}
